package vip.wangwenhao.example.document;

import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Setting;
import vip.wangwenhao.annotation.DefinitionQuery;
import vip.wangwenhao.document.BaseDocument;
import vip.wangwenhao.enums.QueryTypeEnum;

/**
*  
*
* @author wwh
*
*/
//@Mapping(mappingPath = "es/elasticsearch_mapping.json")//设置mapping
@Setting(settingPath = "es/elasticsearch_setting.json")//设置setting
@Document(indexName = "user")
@Data
public class UserDocument extends BaseDocument {

    /**
     * 用户名
     */
    @Field(type = FieldType.Text, analyzer = "ik_pinyin_analyzer")
    @DefinitionQuery(type = QueryTypeEnum.SHOULD)
    @DefinitionQuery(type = QueryTypeEnum.FUZZY)
    private String username;

    /**
     * 年龄
     */
    @Field(type = FieldType.Integer)
    @DefinitionQuery(type = QueryTypeEnum.RANGE)
    private Integer age;



}